import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import urlResourceReader.*;



public class Main
{
	static final UrlResourceReader urr = new UrlResourceReader(System.out);
	
	public static void commandLineInterface (String message)
	{
		BufferedReader cin = new BufferedReader(new InputStreamReader(System.in));
		String exit = "exit";
		String input = "";
		System.out.println(message);
		
		while(true)
		{
			System.out.print(">");
			try
			{
				input = new String();
				input = cin.readLine();
				
				if(input.equals(exit))
					break;
				
				urr.getResource(input);
				
			} catch (IOException e)
			{
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		urr.close();
	}

	/**
	 * @param args
	 */
	public static void main(String[] args)
	{
		Main.commandLineInterface("Please enter a URL or 'exit' to quit:");
		System.out.println("bye!");
	}

}
